<template>
	<view class="content" v-if="show">
		
		
		<!-- <vi size="32"></vi> -->
		<myView height="32"></myView>
		<myImg src="/static/index/sjrz.jpg" width="686" height="340"></myImg>
		<!-- 商家入驻流程 -->
		<myTimeLine :list="applyFlows" marginTop="48"></myTimeLine>
		
		<myBtu  title="申请入驻" type="primary" width="686" height="72" marginTop="120" @confirm="toApply"></myBtu>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				
				applyFlows:[
					{
						icon: 'photo',
						title: '第一步 申请入驻',
						content: '点击申请入驻'
					},
					{
						icon: 'photo',
						title: '第二步 联系开发者',
						content: '联系开发者提供相应信息'
					},
					{
						icon: 'photo',
						title: '第三步 完善店铺信息',
						content: '完善店铺信息，申请相关小程序，商户号等'
					}
				]
			}
		},
		
		async onLoad(options){
			console.log('options',options)
			// #ifdef MP-WEIXIN
				await this.$login();
			// #endif
			this.$log('options',options)
			// #ifdef H5
				await this.$gzhLogin();
			// #endif
			console.log('options',options)
			let needJump = await this.handleOptions(options); //配合mpShare.js实现
			this.$log(needJump);
			this.$log('我执行了');
			setTimeout(()=>{
				this.show=true;
			},2000)
			if(!needJump){
				this.show=true;
				//不需要跳转，才初始化页面
				this.init();
				// let res=await this.$u.api.getUser();
				// this.$log(res);
			}
		},
		computed: {

		},
		onShow() {
			//从别的页面返回的时候，返回到首页 如果没数据就需要初始化数据
			if(this.show){
				this.init();

			}
		},
		methods: {
			handleOptions(options){
				//处理页面传值 封装为Promise
				return new Promise((resolve,reject)=> {
					let route = options.route || '';
					console.log('route',route);
					if(!route || this.$u.test.contains("/pages/index/index",route)){
						resolve(false); 
						return;
					}
					let params;
					// #ifdef MP-WEIXIN
					if(!this.$u.test.isEmpty(options,params)){
						this.$log('options.params',options.params);
						params=JSON.parse(options.params);
						this.$log('params',params);
					}
					// #endif
					// #ifdef H5
					params=options;
					// #endif
					
					let type = 'navigateTo';
					if(this.$u.test.contains(
						"/pages/index/index,/pages/me/me",
					route)){
						type = 'swichTab'
					}
					//路由传参
					this.$u.route({
						type: type,
						url: route,
						params: params
					})
					resolve(true);
				})
			},
			async init(){
		
			},
			toApply() {
				this.$log("confirm",confirm);
				this.$u.route({
					url:'/subpages/me/form/applyForm'
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	
</style>

